#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

string encode(string str)
{
   string rtn;
   if (str.size() == 0) return rtn;
   
   for (int i = 0; i < str.size(); ) {
       int count = 1;
       char c = str[i];
       while (++i < str.size() && str[i] == c) count++; 
       rtn += count + '0';
       rtn += c;
   }
   return rtn;
}


int main(int argc, char **argv)
{

    cout << "-----------------Test 1--------------------" << endl;
    string test1 = "1111211234";
    cout << encode(test1) << endl;

    cout << "-----------------Test 2--------------------" << endl;
    string test2 = "1";
    cout << encode(test2) << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
